package com.hmall.common.client;

import com.hmall.common.dto.PageDTO;
import com.hmall.common.pojo.Item;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.core.annotation.Order;
import org.springframework.web.bind.annotation.*;

/**
 * @Description TODO
 * @Author fang
 * @Date 2023-06-06 21:35
 */
@FeignClient("itemservice")
public interface ItemClient {

    /**
     * 根据id查询
     */
    @GetMapping("/item/{id}")
    public Item getById(@PathVariable Long id);

    /**
     * 提交订单 - 扣减库存
     *
     * @param itemId
     * @param num
     */
    @PutMapping("/item/stock/{itemId}/{num}")
    public void stock(@PathVariable Long itemId, @PathVariable Integer num);

    /**
     * 修改商品
     */
    @PutMapping("/item")
    public void updata(@RequestBody Item item);

    @GetMapping("/item/list")
    public PageDTO<Item> list(@RequestParam("page") Integer page,@RequestParam("size") Integer size);

}
